import React, { Component, lazy, Suspense } from 'react'
import { BrowserRouter as Router, Route, Link } from 'react-router-dom'
const Home = lazy(()=>import('./components/Home'))
const User = lazy(()=>import('./components/User'))

export default class App extends Component {
  render() {
    return (
      <Suspense fallback={<div>loading...</div>}>
        <Router>
          <Link to='/'>主页</Link>
          <Link to='/user'>用户</Link>
          <Route exact path='/' render={(props)=><Home {...props}></Home>}></Route>
          <Route exact path='/user' render={(props)=><User {...props}></User>}></Route>
        </Router>
      </Suspense>
    )
  }
}
